package com.practice;


//优化 因为随机抽取 可能会一直取不出某个奖项
//所以 直接将奖池打乱进行顺序抽取即可

import java.util.Random;

public class Prize2 {
    public static void main(String[] args) {
        //奖池
        int[] arrPrize = {2, 588, 888, 1000, 10000};

        //打乱原有的奖池顺序
        Random r = new Random();
        for (int i = 0; i < arrPrize.length; i++) {
            int randomIndex=r.nextInt(arrPrize.length);
            int temp;
            temp=arrPrize[i];
            arrPrize[i]=arrPrize[randomIndex];
            arrPrize[randomIndex]=temp;
        }
        for (int i = 0; i < arrPrize.length; i++) {
            System.out.print(arrPrize[i]+" ");
        }
    }
}
